package com.springboot.orderno.common;

/**
 * ResultVO返回状态码
 */
public enum ResultCode {

	success(0, "成功"), fail(1, "失败"), tips(2, "提示");

	private int code;
	private String name;

	private ResultCode(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public int getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	/**
	 * 
	 * @param name
	 * @return
	 */
	public static int getCode(String name) {
		for (ResultCode status : ResultCode.values()) {
			if (status.getName().equals(name)) {
				return status.code;
			}
		}
		return 0;
	}
}
